/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pa165.dominating.species.service;

import java.util.List;
import pa165.dominating.species.tos.AnimalTo;
import pa165.dominating.species.tos.EnvironmentTo;

/**
 *
 * @author Filip Dinh
 */
public interface AnimalService {

    /**
     * Stores animal into database. Id for the new animal is automatically
     * generated and stored into id attribute.
     *
     * @param animalTo animal to be created.
     */
    public void createAnimal(AnimalTo animalTo);

    /**
     * Updates animal in database.
     *
     * @param animalTo updated animal to be stored into database.
     */
    public void updateAnimal(AnimalTo animalTo);

    /**
     * Deletes animal from database.
     *
     * @param animalTo animal to be deleted from db.
     */
    public void deleteAnimal(AnimalTo animalTo);

    /**
     * Returns list of all animals in the database.
     *
     * @return list of all animals in database.
     */
    public List<AnimalTo> getAllAnimals();

    /**
     * Returns animal with given id.
     *
     * @param id primary key of requested animal.
     * @return animal with given id or null if such animal does not exist.
     */
    public AnimalTo getAnimalById(Long id);

    /**
     * Returns animals that live in the given environment.
     *
     * @param environmentTo
     * @return animals living in the given environment.
     */
    public List<AnimalTo> getAnimalsByEnvironment(EnvironmentTo environmentTo);

    /**
     * Puts given prey to the list of predator´s prey and puts given predator to
     * the list of prey´s predators.
     *
     * @param predator
     * @param prey
     */
    public void addPreyToPredator(AnimalTo predator, AnimalTo prey);

    /**
     * Removes the given prey from list of given predator´s prey and removes the
     * predator from list of given prey´s predators.
     *
     * @param predator
     * @param prey
     */
    public void removePreyOfPredator(AnimalTo predator, AnimalTo prey);

    /**
     * Returns all predators of given prey.
     *
     * @param prey
     * @return list of all predators of the prey.
     */
    public List<AnimalTo> getPredatorsOfPrey(AnimalTo prey);

    /**
     * Returns all prey of given predator.
     *
     * @param predator
     * @return list of all prey of the predator.
     */
    public List<AnimalTo> getPreyOfPredator(AnimalTo predator);
}
